package com.zycfc.zsf.boot.core.common;

public enum EnvNameEnum
{
    local, 
    dev, 
    sit, 
    uat, 
    auto, 
    mig, 
    tke, 
    cred, 
    sec, 
    u2, 
    u3, 
    sit830, 
    uat830, 
    dev830, 
    pfm, 
    sit2, 
    uat3, 
    rc, 
    prod;
    
    private static final String ILLEGAL_ENV_NAME = "\u975e\u6cd5\u7684\u73af\u5883\u540d\u79f0\uff1a";
    
    public static void check(final String env) {
        for (final EnvNameEnum envName : values()) {
            if (envName.name().equals(env)) {
                return;
            }
        }
        throw new IllegalArgumentException("\u975e\u6cd5\u7684\u73af\u5883\u540d\u79f0\uff1a" + env);
    }
    
    public static String getProfile(final String[] envs) {
        if (envs == null) {
            return null;
        }
        for (final EnvNameEnum envName : values()) {
            for (final String env : envs) {
                if (envName.name().equals(env)) {
                    return env;
                }
            }
        }
        return null;
    }
}
